package routers

import (
	"alarmservice/www/controllers"
	"alarmservice/www/mobilecontrollers"
	"github.com/astaxie/beego"
)

func init() {
	//移动端API路由
	beego.Router("/mapi/login", &mobilecontrollers.LoginController{})
	//warning
	beego.Router("/mapi/warning/list", &mobilecontrollers.WarningController{}, "post:ApiList")
	beego.Router("/mapi/warning/detail", &mobilecontrollers.WarningController{}, "post:ApiDetail")
	beego.AutoRouter(&mobilecontrollers.TestController{})


	//网站项目路由
	//index
	indexController := &controllers.IndexController{}
	beego.Router("/", indexController, "get:PageIndex")
	beego.Router("/help", indexController, "get:PageHelp")

	//login
	loginRegController := &controllers.LoginRegController{}
	beego.Router("/login", loginRegController, "get,post:PageLogin")
	beego.Router("/reg", loginRegController, "get,post:PageReg")

	userController := &controllers.UserController{}
	beego.Router("/logout", userController, "get,post:PageLogout")
	beego.Router("/user/profile", userController, "get,post:PageProfile")
	beego.Router("/user/password", userController, "get,post:PagePassword")
	beego.Router("/user/ajaxinvite", userController, "get:PageAjaxInvite")
	beego.Router("/user/ajaxGetUsersByNameUserName", userController, "get:PageAjaxGetUsersByNameUserName")

	//project
	projectController := &controllers.ProjectController{}
	beego.Router("/project/:pid/update", projectController, "get,post:PageUpdate")
	beego.Router("/project/:pid/warnings", projectController, "get,post:PageWarningList")
	beego.Router("/project/:pid/ajaxAddUser", projectController, "post:PageAjaxAddUser")
	beego.Router("/project/:pid/ajaxRemoveUser", projectController, "post:PageAjaxRemoveUser")
	

	beego.Router("/project/:pid", projectController, "get:PageDetail")
	beego.Router("/project/create", projectController, "get,post:PageCreate")
	beego.Router("/project", projectController, "get:PageList")
	beego.Router("/project/my", projectController, "get:PageMyList")

	//tracing
	tracingController := &controllers.TracingController{}
	beego.Router("/project/:pid/tracing", tracingController, "get:PageList")
	beego.Router("/project/:pid/tracing/create", tracingController, "get,post:PageCreate")
	beego.Router("/project/:pid/tracing/:tid/update", tracingController, "get,post:PageUpdate")
	beego.Router("/project/:pid/tracing/:tid/warnings", tracingController, "get:PageWarningList")
	
	//tracingajax
	
	beego.Router("/project/:pid/tracing/:tid/ajaxSetStatus", tracingController, "post:PageAjaxSetStatus")
	beego.Router("/project/:pid/tracing/ajaxDelTracing", tracingController, "post:PageAjaxDelTracing")
	
	//api
	beego.AutoRouter(&controllers.ApiController{})
	
	//states
	statesController := &controllers.StatesController{}
	beego.Router("/states/timertracing", statesController, "get:PageTimerTracing")
}
